<?php 
class App_Page_Pager_AdminLayout extends Main_Pager
{
	/**
	 * @var array
	 */
	protected $_fields = array(
		'id'   => array('simpleSearch' => true, 'sql' => 'layout.id'),
		'name' => array('simpleSearch' => true, 'sql' => 'layout.name'),
		'title' => array('simpleSearch' => true, 'sql' => 'layout_i18n.title'),	
	);
	
	/**
	 * @return void
	 */
	protected function _init()
	{
		//sleep();
		
		$this->_config['base'] = "
			SELECT 
				layout.id
				, layout.name
				, layout_i18n.title  	
			FROM
				layout 
			INNER JOIN
				layout_i18n 
				ON
					(layout.id=layout_i18n.layout_id AND layout_i18n.lang_id={$this->_langId})
			WHERE true		
		";
				
		$this->_config['count'] = "
			SELECT 
				COUNT(layout.id)
			FROM
				layout 
			INNER JOIN
				layout_i18n 
				ON
					(layout.id=layout_i18n.layout_id AND layout_i18n.lang_id={$this->_langId})
			WHERE true	
		";		

		$this->_service = new App_Page_Service_Layout();
						
		parent::_init();			
	}
	
	/**
	 * @param int|string $primary
	 * @return bool
	 */
	protected function _deleteItem($primary) 
	{
		return $this->_service->deleteItem($primary);
	}
}


